package Service;

import Entity.User;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;


public class UserService {



	public boolean register(User user){
		Gson gson=new Gson();
		String userJson = gson.toJson(user);
		Map map = gson.fromJson(userJson, Map.class);
		map.put("cmd","register");
		userJson = gson.toJson(map);
		new Transfer_station().transfer(userJson);
		return true;
	}

	public String login(String username,String password){
		Gson gson=new Gson();
		Map<String, String> map = new HashMap<String,String>();
		map.put("username",username);
		map.put("password",password);
		map.put("cmd","login");
		String Json = gson.toJson(map);
		return new Transfer_station().transfer(Json);
	}

}
